/**
 * @ClassName LC2652
 * @Author ykx
 * @Date 2024/3/22 8:36
 * @Version 1.0
 */
public class LC2652 {
    public static void main(String[] args) {
        LC2652 lc2652 = new LC2652();
        System.out.println(lc2652.sumOfMultiples(7));
    }

    public int sumOfMultiples(int n) {
        int result = 0;
        for (int i = 1; i <= n; i++) {
            result += i % 3 == 0 || i % 5 == 0 || i % 7 == 0 ? i : 0;
        }
        return result;
    }
}
